package com.ler.yrmall.ware.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ler.yrmall.ware.entity.WareOrderTaskDetailEntity;
import com.ler.yrmall.ware.mapper.WareOrderTaskDetailDao;
import com.ler.yrmall.ware.service.WareOrderTaskDetailService;
import com.ler.yrmall.ware.vo.WareOrderTaskDetailVO;
import com.ler.yrmall.basic.Form;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class WareOrderTaskDetailServiceImpl extends ServiceImpl<WareOrderTaskDetailDao, WareOrderTaskDetailEntity> implements WareOrderTaskDetailService {

    @Override
    public IPage<WareOrderTaskDetailVO> queryPage(Form request) {
        IPage<WareOrderTaskDetailEntity> page = this.page(request.getPage());
        return page.convert(item -> {
            WareOrderTaskDetailVO target = new WareOrderTaskDetailVO();
            BeanUtils.copyProperties(item,target);
            return target;
        });
    }

    @Override
    public List<WareOrderTaskDetailEntity> listByTaskId(Long taskId) {
        return this.list(Wrappers.<WareOrderTaskDetailEntity>lambdaQuery().eq(WareOrderTaskDetailEntity::getTaskId,taskId));
    }

}